<?php


namespace app\common\model;


use app\common\library\Auth;
use think\Model;
use think\Request;
use traits\model\SoftDelete;

class Package extends Model
{
    use SoftDelete;
    // 表名
    protected $name = 'package';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [
    ];

    public function getImageAttr($value, $data)
    {
        $request = Request::instance();
        $domain=$request->domain();
        return $domain.$value;
    }

    public function getImagesAttr($value, $data)
    {
        $request = Request::instance();
        $domain=$request->domain();
        $value = explode(',',$value);
        foreach ($value as &$item) {
            $item = $domain.$item;
        }
        return $value;
    }


    public function tag()
    {
        return $this->belongsTo('Tag', 'tag_id', 'id');
    }

    public function staff()
    {
        return $this->belongsTo('Staff', 'staff_id', 'id');
    }
}